import {Button} from "antd";
import {useNavigate} from "react-router-dom";

export default function A () {
    const navigate = useNavigate()
    const nextTo = () => {

        /*
        * 显式传参
        * */

        // navigate('/c')
        // navigate({
        //     pathname:'/c',
        //     search: 'id=111&name=张三'
        // })

        /*
        * 隐式传参
        * */

        navigate('/c',{
            //历史记录池替换现有地址
            replace:true,
            state:{
                id:111,
                name:'zhang'
            }
        })

    }
    return  <>
            <div>页面A</div>
            <Button type="primary" onClick={nextTo}>跳转</Button>
        </>
}
